<?php
Route::group(['middleware' => 'web', 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{
    //登录等操作是否需要判断用户已经登录? 不需要判断是否登陆
    Auth::routes();
});
//判断是否登录，登录就进入下面的路由
Route::group(['middleware'=>['web','auth:admin'], 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{
    Route::get('/','AdminController@create');

    Route::get('/home','AdminController@index')->middleware('permission:admin');
    //后台模块用户管理资源路由
    Route::resource('/adminuser','AdminUserController')->middleware('permission:admin,resource');
    //后台角色管理路由
    Route::resource('/role','RoleController')->middleware('permission:admin,resource');
    //展示权限路由
    Route::get('/showPermission/{roleid}','RoleController@showPermission')->name('showPermission')->middleware('permission:admin');
    //post处理权限路由
    Route::post('/permission/{roleid}','RoleController@permission')->name('permission')->middleware('permission:admin');
    //用户分配角色加载路由模板
    Route::get('/showRole/{adminid}','AdminUserController@showRole')->name('showRole')->middleware('permission:admin');
    //配置用户权限处理路由
    Route::post('/assignRole/{adminid}','AdminUserController@assignRole')->name('assignRole')->middleware('permission:admin');
    //模块列表路由
    Route::get('/module','ModuleController@index')->name('module')->middleware('permission:admin');
    //更新模块路由
    Route::get('/updateCache','ModuleController@updateCache')->name('updateCache')->middleware('permission:admin');
    //设为默认模块路由
    Route::get('/setDefaultModule/{module}','ModuleController@setDefaultModule')->name('setDefaultModule')->middleware('permission:admin');
    //设置默认模板路由
    Route::resource('/template','TemplateController')->middleware('permission:admin,resource');
    //添加友链路由
    Route::resource('/link','LinkController')->middleware('permission:admin,resource');
});